import { Component } from '@angular/core';
import { FormBuilder, FormGroup } from '@angular/forms';
import { map } from 'rxjs/operators';
import { CountService } from './common/count/count.service';
import { WebsocketService } from './common/websocket.service';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.scss']
})
export class AppComponent {
  title = 'project';
  text = '1';
  items = [1, 2, 3, 4]

  helloForm: FormGroup;
  constructor(public count: CountService, socket: WebsocketService, public fb: FormBuilder) {
    // socket.createObservableWebSocket('ws://localhost:3000')
    // .subscribe(data => {
    //   console.log(data);
    // })

    this.helloForm = this.fb.group({
      count: 5
    });
    this.helloForm.controls.count.setValue(20)
  }


  focus(ev) {
    console.log(ev);
  }
  fileList: any[] = [];
  limit500(file: File): boolean {
    if (file.size > 500000) {
      console.log('文件超过了 500 kb.')
      return false
    }
    return true
  }
  
}
